<?php

use Biz\service\activity\Popup as sPopUp;

class CallbackAction extends ActionPlugin
{
    const DEFAULT_ERROR_CODE = self::API_CODE_ERROR;

    public function main()
    {
        $popupId = $this->getRequest()->getPost('popup_id', 0);
        if ($popupId) {
            $uid = $this->uid > 0 ? $this->uid : $this->vid;
            $isVisitor = $this->uid ? false : true;
            $result = sPopUp::addPopUpLog($uid, $popupId, $isVisitor);
            if ($result) {
                $this->setSuccess(null);
            } else {
                throw new \Exception('操作错误');
            }
        } else {
            throw new \Exception('参数错误');
        }


    }

}
